﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ObviousCode.UI.Aspect.ExceptionRendering
{
    public partial class BasicExceptionReporting : Form
    {
        Exception _exception;

        public BasicExceptionReporting(Exception e)
        {
            InitializeComponent();
            _exception = e;
        }

        private void BasicExceptionReporting_Load(object sender, EventArgs e)
        {
            _headerLabel.Text = string.Format("An error of type {0} was detected", _exception.GetType().ToString()                
                );

            _innerExceptionHeader.Text = 
                _exception.InnerException == null ? "No Inner Exception" :
                string.Format("Inner Exception of {0}", _exception.InnerException.GetType().ToString());

            _exceptionMessage.Text = string.Format("{0}{1}{2}", _exception.Message, Environment.NewLine, _exception.StackTrace);
            _innerExceptionMessage.Text = _exception.InnerException == null ? "" : 
                string.Format("{0}{1}{2}", _exception.InnerException.Message, Environment.NewLine, _exception.InnerException.StackTrace);
        }

        
    }
}
